package com.token.controller;

import com.token.domain.AjaxResult;
import com.token.utils.JWTUtil;
import com.token.utils.SystemInfoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@EnableScheduling
public class Test {

    @Autowired
    private ConfigurableApplicationContext context;

    private static final String LICENSE_PATH = "LICENSE.txt";

    @GetMapping("/test")
    public AjaxResult test() throws IOException {
        return AjaxResult.success("成功！！！！");
    }

    @GetMapping("/apply")
    public AjaxResult apply(){
        JWTUtil.applyToken(SystemInfoUtil.getSystemInfo());
        return AjaxResult.success("申请成功！！！！");
    }

    @GetMapping("/info")
    public AjaxResult info(){
        return AjaxResult.success(SystemInfoUtil.getSystemInfo());
    }
}
